package petrochina.company.electric.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * 任务完成提交数据
 */
public class TaskStepInfo implements Parcelable {

    // id
    private long stepId;

    // 完成状态
    private int stepStatus;

    // 任务设备值
    private int stepEquipValue;

    // 实际操作状态
    private int actOperType;

    // 操作标识（1：系统执行 2：人工确认）
    private int operIdentifyType;

    public long getStepId() {
        return stepId;
    }

    public void setStepId(long stepId) {
        this.stepId = stepId;
    }

    public int getStepStatus() {
        return stepStatus;
    }

    public void setStepStatus(int stepStatus) {
        this.stepStatus = stepStatus;
    }

    public int getStepEquipValue() {
        return stepEquipValue;
    }

    public void setStepEquipValue(int stepEquipValue) {
        this.stepEquipValue = stepEquipValue;
    }

    public int getActOperType() {
        return actOperType;
    }

    public void setActOperType(int actOperType) {
        this.actOperType = actOperType;
    }

    public int getOperIdentifyType() {
        return operIdentifyType;
    }

    public void setOperIdentifyType(int operIdentifyType) {
        this.operIdentifyType = operIdentifyType;
    }

    public static Creator<TaskStepInfo> getCREATOR() {
        return CREATOR;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.stepId);
        dest.writeInt(this.stepStatus);
        dest.writeInt(this.stepEquipValue);
        dest.writeInt(this.actOperType);
        dest.writeInt(this.operIdentifyType);
    }

    public void readFromParcel(Parcel source) {
        this.stepId = source.readLong();
        this.stepStatus = source.readInt();
        this.stepEquipValue = source.readInt();
        this.actOperType = source.readInt();
        this.operIdentifyType = source.readInt();
    }

    public TaskStepInfo(long stepId, int stepStatus, int stepEquipValue, int actOperType, int operIdentifyType) {
        this.stepId = stepId;
        this.stepStatus = stepStatus;
        this.stepEquipValue = stepEquipValue;
        this.actOperType = actOperType;
        this.operIdentifyType = operIdentifyType;
    }

    protected TaskStepInfo(Parcel in) {
        this.stepId = in.readLong();
        this.stepStatus = in.readInt();
        this.stepEquipValue = in.readInt();
        this.actOperType = in.readInt();
        this.operIdentifyType = in.readInt();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TaskStepInfo)) return false;
        TaskStepInfo that = (TaskStepInfo) o;
        return getStepId() == that.getStepId();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getStepId(), getStepStatus(), getStepEquipValue(), getActOperType());
    }

    public static final Creator<TaskStepInfo> CREATOR = new Creator<TaskStepInfo>() {
        @Override
        public TaskStepInfo createFromParcel(Parcel source) {
            return new TaskStepInfo(source);
        }

        @Override
        public TaskStepInfo[] newArray(int size) {
            return new TaskStepInfo[size];
        }
    };
}
